require('./PageAwarddetail.styl');
import { Control } from 'react-keeper'
const reactMixin = require('react-mixin');
const Actions = require('./actions');
const Store = require('./store');
import { Boxs, NavBar, TextareaField, Context } from 'saltui';
const { HBox, Box, VBox } = Boxs;
const classNames = require("classnames")
class Awarddetail extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            title: "",
            studentName: '',
            list: [],//评价内容数组
            msg: '',
            date: '',
            teachername: ''
        };
        this.handleOnLeftClick = this.handleOnLeftClick.bind(this)
    }
    handleOnLeftClick() {
        Control.go(-1)
    }

    render() {
        let t = this;
        return (
            <div className="awarddetail">
                <NavBar
                    className={classNames({"ios-nav-bar":window.isIphone})}
                    isShow={false}
                    title='奖励详情'
                    onLeftClick={this.handleOnLeftClick.bind(this)}
                    onRightClick={Context.noop}
                    rightText=''
                />
                <VBox className="awarddetail-box">
                    <Box className="t-PT12 t-PL10">{this.state.title}</Box>
                    <Box className="t-MT26 awarddetail-box-content">
                        <p>{this.state.msg}</p>
                        {
                            this.state.list && this.state.list instanceof Array && this.state.list.length > 0 && this.state.list.map((item, index) => {
                                return (<p className="t-MT4">
                                    {item.content}
                                </p>);
                            })
                        }
                    </Box>
                    <Box className="t-FAR awarddetail-box-foot t-MT45 t-MR10">
                        <p>老师：{this.state.teachername}</p>
                        <p className="t-MT8">{this.state.date}</p>
                    </Box>
                </VBox>
            </div>
        );
    }

    componentWillMount() {
    }

    componentDidMount() {
        Actions.fetchDetail(Control.state.data)
    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}

reactMixin.onClass(Awarddetail, Reflux.connect(Store));

module.exports = Awarddetail;
